package com.afdor.rws.event.driven.config;

import com.afdor.rws.annotation.extension.Extension;
import com.afdor.rws.annotation.extension.SPI;
import com.afdor.rws.event.driven.commons.Constants;
import lombok.Data;
import lombok.NonNull;

import java.io.Serializable;

/**
 * 消费者相关配置<br/>
 * Extension : prototype
 *
 * @author 悭梵
 * @date Created in 2018-11-21 15:45
 */
@Data
@SPI(Constants.DEFAULT_COMPONENT_CONFIG_EXTENSION_NAME)
@Extension(value = Constants.DEFAULT_COMPONENT_CONFIG_EXTENSION_NAME, scope = Extension.Scope.PROTOTYPE, interfaceClass = EventConsumerConfig.class)
public class EventConsumerConfig extends BaseEventConfig implements Serializable, Cloneable {

    /**
     * 消费者名称。默认default
     */
    private String consumerName = "default";
    /**
     * 消费者事件重试策略扩展点名称。默认default，由EventRetryStrategy.SPI("default")负责激活默认值。
     */
    private String eventRetryStrategyName;
    /**
     * 消费者监听事件处理间隔事件，单位毫秒，默认100
     */
    private int eventHandlerPeriod = 100;
    /**
     * 一次性获取消息的数量，用于批量处理，默认：50
     */
    private int batchSize = 50;

    public EventConsumerConfig() {
    }

    public EventConsumerConfig(@NonNull final EventConfig eventConfig) {
        setEventConfig(eventConfig);
    }
}
